<?php
namespace Admin\Model;
use Think\Model\RelationModel;
/**
 * 产品与编辑人的关联模型
 */
class StorageRelationModel extends RelationModel{
	//定义主表名称
	protected $tableName='storage';

	//定义关联关系
	protected $_link=array(
		'depot'=>array(
			'mapping_type'=>self::BELONGS_TO,
			'class_name'    => 'depot',
			'foreign_key'=>'depot_id',
			'as_fields'=>'name:depotname'
			),
		'supplier'=>array(
			'mapping_type'=>self::BELONGS_TO,
			'class_name'    => 'supplier',
			'foreign_key'=>'supplier_id',
			'as_fields'=>'name:suppliername'
			),
		'goods'=>array(
			'mapping_type'=>self::BELONGS_TO,
			'class_name'  =>'goods',
			'foreign_key' =>'goods_id',
			'as_fields'   =>'id:gid,name:goodsname,xinghao,guige,unit'
			),
		'manager'=>array(
			'mapping_type'=>self::BELONGS_TO,
			'class_name'    => 'manager',
			'foreign_key'=>'uid',
			'as_fields'=>'realname'
			)
		);
	
}
